<!--
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
    file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<!--
    Copyright (c) 2015, Joyent, Inc.
-->

<div class="row">
    <div class="col-md-8 col-md-offset-1">
        <div class="page-header">
            {{#if networkPool.uuid}}
                <h4 class="modal-title">Edit Network Pool {{networkPool.name}}</h4>
            {{else}}
                <h4 class="modal-title">Create Network Pool</h4>
            {{/if}}
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-9 col-md-offset-1">
        <form class="form-horizontal">
            <div class="alert alert-danger hide"></div>
            <div class="form-group">
                <label class="control-label col-sm-4">Network Pool Name</label>
                <div class="controls col-sm-7">
                    <input type="text" class="form-control" name="name" value="{{name}}" placeholder="name of network pool">
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-sm-4">Description</label>
                <div class="controls col-sm-7">
                    <input type="text" class="form-control" name="description" value="{{description}}" placeholder="network pool description (optional)">
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-sm-4">Networks</label>
                <div class="controls col-sm-7">
                    <div class="chosen">
                        <select class="form-control" width="100%" name="networks" multiple>
                            {{#each networks}}
                                <option {{#if this.selected}}selected{{/if}}
                                    value="{{this.uuid}}">{{this.name}} / {{this.subnet}}
                                </option>
                            {{/each}}
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-sm-4">Owner</label>
                <div class="controls col-sm-7">
                {{#if owner_uuids.length}}
                {{#each owner_uuids}}
                    <div class="row">
                        <div class="col-sm-12">
                            <input type="text" name="owner_uuids[]" value="{{this}}" class="form-control" placeholder="Search by login, email or uuid"></input>
                            <span class="help-block">Optionally select an owner</span>
                        </div>
                    </div>
                {{/each}}
                {{else}}
                    <div class="row">
                        <div class="controls col-sm-12">
                            <input type="text" name="owner_uuids[]" value="" class="form-control" placeholder="Search by login, email or uuid"></input>
                            <span class="help-block">Optionally select an owner</span>
                        </div>
                    </div>
                {{/if}}
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-4 col-sm-8">
                    <button type="submit" class="btn btn-primary save">Save Network Pool</button>
                    <button type="cancel" class="btn btn-default">Cancel</button>
                </div>
            </div>
        </form>
    </div>
</div>
